<script setup lang="ts">

defineProps({
  title: {
    type: String,
    default: "标题"
  },
  flexDirection: {
    type: String,
    default: "row"
  },
  topRightHidde: {
    type: Boolean,
    default: false
  },
  topLeftHidde: {
    type: Boolean,
    default: false
  },
  bottomRightHidde: {
    type: Boolean,
    default: false
  },
  bottomLeftHidde: {
    type: Boolean,
    default: false
  },
  headImgHidde: {
    type: Boolean,
    default: false
  }
})
</script>

<template>
  <div class="container-view">
    <span v-if="!topLeftHidde" class="top-left"></span>
    <span v-if="!topRightHidde" class="top-right"></span>
    <span v-if="!bottomLeftHidde" class="bottom-left"></span>
    <span v-if="!bottomRightHidde" class="bottom-right"></span>

    <div class="content">
      <div class="img-box" v-if="!headImgHidde">
        <img src="@/assets/main_images/containerDriver.png" alt="暂无图源">
      </div>
      <div class="head-container">
        <span class="title">{{ title }}</span>
        <div class="right">
          <slot name="action"/>
        </div>
      </div>
      <div class="slot-container" :style="{flexDirection:flexDirection}">
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
@use "@/styles/variables" as *;

.container-view {
  position: relative;
  border: 1px solid rgba(#06b6b954, .2);
  color: #f6f2f2;

  .content {
    display: flex;
    flex-direction: column;
    padding: 10px 15px;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 32, 105, 0.3);
    box-shadow: 0 0 50px rgba(#0b4495, .2) inset;
    box-sizing: border-box;

    .img-box {
      width: calc(100% - 15px);
      position: absolute;
      left: 15px;
      top: 22px;

      img {
        width: 95%;
        height: 12px;
      }
    }

    .head-container {
      height: fit-content;
      padding-bottom: 20px;
      box-sizing: border-box;

      .title {
        font-weight: bold;
        font-size: 16px;
        color: #00faff;
      }

      .right {
        position: absolute;
        top: 0;
        right: 0;
      }
    }

    .slot-container {
      overflow-y: auto;
      overflow-x: hidden;
      flex: 1;
      height: 100%;

      &::-webkit-scrollbar {
        /*高宽分别对应横竖滚动条的尺寸*/
        width: 4px;
        height: 7px;
      }

      /*滚动条里面小方块*/
      &::-webkit-scrollbar-thumb {
        border-radius: 8px;
        -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
        background: #00edff;
      }

      /*滚动条里面轨道*/
      &::-webkit-scrollbar-track {
        -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
        border-radius: 10px;
        background: rgba(237, 237, 237, 0);
      }
    }

  }

  .border-size {
    width: 20px;
    height: 20px;
    position: absolute;
    border-style: solid;
  }

  .top-left {
    @extend .border-size;
    left: -3px;
    top: -3px;
    border-width: $containerBorderWith 0 0 $containerBorderWith;
    border-image: linear-gradient(to top right, $containerBorderColor) 2;
  }

  .top-right {
    @extend .border-size;
    right: -3px;
    top: -3px;
    border-width: $containerBorderWith $containerBorderWith 0 0;
    border-image: linear-gradient(to top left, $containerBorderColor) 2;
  }

  .bottom-right {
    @extend .border-size;
    right: -3px;
    bottom: -3px;
    border-width: 0 $containerBorderWith $containerBorderWith 0;
    border-image: linear-gradient(to bottom left, $containerBorderColor) 2;
  }

  .bottom-left {
    @extend .border-size;
    bottom: -3px;
    left: -3px;
    border-width: 0 0 $containerBorderWith $containerBorderWith;
    border-image: linear-gradient(to bottom right, $containerBorderColor) 2;
  }
}
</style>
